package com.hehe.conversion.hehemiddleware.controller;

import com.alibaba.fastjson.JSONObject;
import com.hehe.conversion.hehemiddleware.model.RootBody;
import com.hehe.conversion.hehemiddleware.model.req.BodyParam;
import com.hehe.conversion.hehemiddleware.service.EsbRequestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class MiddlewareController {

    @Autowired
    EsbRequestService esbRequestService;
    @PostMapping(value = "/cci_ai/service/v1/id_card")
    public RootBody idCard(@RequestBody BodyParam bodyParam) {
        log.info(" MiddlewareController idCard request:{}", JSONObject.toJSONString(bodyParam));
        return esbRequestService.handleIdCardRequest(bodyParam);
    }
    @PostMapping(value = "/ai/service/v1/business_license")
    public RootBody businessLicense(@RequestBody BodyParam bodyParam) {
        log.info(" MiddlewareController businessLicense request:{}", JSONObject.toJSONString(bodyParam));
        return esbRequestService.handleBusinessLicenseRequest(bodyParam);
    }

}
